import 'package:flutter/material.dart';

typedef OnClick = void Function();

///
/// 左边是热门，右边是全部
///
class ItemCountTitle extends StatelessWidget {
  final int? count;
  final OnClick? onClick;
  final String title;
  final double? fontSize;

  const ItemCountTitle(this.title, {Key? key, this.onClick, this.count, this.fontSize})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      child: Row(
        children: <Widget>[
          Expanded(
              child: Text(
            title,
            style: TextStyle(
                fontSize: fontSize ?? 14,
                fontWeight: FontWeight.bold,
                color: const Color.fromARGB(255, 45, 45, 45)),
          )),
          Text(
            '全部 ${count ?? 0} > ',
            style: const TextStyle(
                fontSize: 12, color: Colors.grey, ),
          )
        ],
      ),
      onTap: () {
        if (onClick != null) {
          onClick!.call();
        }
      },
    );
  }
}
